package com.yy.xshell.process.resultHandler;

import com.alibaba.fastjson2.JSONObject;
import com.yy.xshell.process.Handler;

/**
 * 创建一个可编辑器如果没有
 * @author wxy
 * @version 1.0
 * @date 2024/11/25 15:37
 */
public class CreateEditHandler extends Handler<JSONObject> {

    private final static String reg = "\033[\\?1H";

    @Override
    public JSONObject handler(JSONObject command) {
        String msg = command.getString("msg");
        msg = msg.replace(reg, "");
        command.put("msg", msg);
        //进入私有模式
        command.put("mode", true);
        return null;
    }



    @Override
    public boolean accept(JSONObject command) {
        return command.getString("msg").contains(reg);
    }
}
